Add custom provider protocol support for OpenAI-compatible and Gemini-native APIs#20
Open
lartpang wants to merge 9 commits intoResearAI:mainfrom
Open
Add custom provider protocol support for OpenAI-compatible and Gemini-native APIs#20lartpang wants to merge 9 commits intoResearAI:mainfrom
lartpang wants to merge 9 commits intoResearAI:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@HughYau @TuchuanLin @ResearAI
This PR adds protocol-aware API configuration so AutoFigure can work with third-party/custom model providers, not only the built-in OpenRouter, Bianxie, and Google Gemini presets.
It explicitly supports both OpenAI-compatible chat/completions APIs and Gemini Native generateContent APIs across the web workflow.
Changes
API protocol support
Web UI provider configuration
Documentation
Windows/frontend compatibility
:, which is invalid on Windows filesystems.Why
Previously, third-party Gemini-style APIs were only partially supported.
OpenAI-compatible providers could often be used by reusing an existing preset, but Gemini Native generateContent endpoints were not consistently supported across layout generation, methodology extraction, Code2Prompt, and image generation.
The Web UI also did not let users explicitly choose the API protocol, which made custom provider setup ambiguous. This PR makes the provider/protocol relationship explicit and supports third-party Gemini Native endpoints more reliably.
Example
If a provider documents an endpoint like:
configure the Web UI as:
Endpoints ending in
/modelsare normalized automatically, but the version-level base URL is the recommended input.Notes
Gemini Native APIs commonly put the API key in the query string as
?key=.... The explicit debug log masks this value, but a future hardening improvement could sanitize exception messages from lower-level HTTP errors as well.